#!/bin/sh

if test x"$srcdir" != x""; then
    builddir="."	# running from make check, but it does not define that
else
    srcdir=`echo "$0" | sed s,[^/]*$,,`
    test "$srcdir" = "$0" && srcdir=.
    test -z "$srcdir" && srcdir=.
    builddir="$srcdir"	# running manually, have to assume
fi

srcdir=`cd $srcdir;pwd`
builddir=`cd $builddir;pwd`

bad_globals=`nm -g --defined-only $builddir/../libdca/*.o|\
    awk '{if ($3) print $3}'|grep -v '^_\?dca_'`

if test x"$bad_globals" != x""; then
    echo BAD GLOBAL SYMBOLS:
    for s in $bad_globals; do echo $s; done
    exit 1
fi

exit 0
